package com.health.tablebean.webservice;

import java.util.ArrayList;
import java.util.List;

import com.health.viewscontrols.NovaApplication;
import com.health.db.FDbManager;
import com.health.tablebean.SBCL_DATA;

import android.util.Log;

public class MeasurementData {
	private String id;
	private String deviceName;
	private String deviceType;
	private String clType;
	private String clValue;
	private String clTypeName;
	private String guid;
	private String idcard;
	private String clTime;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getDeviceName() {
		return deviceName;
	}

	public void setDeviceName(String deviceName) {
		this.deviceName = deviceName;
	}

	public String getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(String deviceType) {
		this.deviceType = deviceType;
	}

	public String getClType() {
		return clType;
	}

	public void setClType(String clType) {
		this.clType = clType;
	}

	public String getClValue() {
		return clValue;
	}

	public void setClValue(String clValue) {
		this.clValue = clValue;
	}

	public String getClTypeName() {
		return clTypeName;
	}

	public void setClTypeName(String clTypeName) {
		this.clTypeName = clTypeName;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public String getIdcard() {
		return idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}

	public String getClTime() {
		return clTime;
	}

	public void setClTime(String clTime) {
		this.clTime = clTime;
	}

	public static RecordData converData() {
		RecordData recordData = new RecordData();
		
		List<MeasurementData> dataList = new ArrayList<>();
		List listId = new ArrayList<>();
		
		FDbManager fdbmanger = NovaApplication.fdbmanger;
		MeasurementData data;
		List<SBCL_DATA> list = fdbmanger.findAllByWhere(SBCL_DATA.class,"IS_UPDATE is not 'N'" ,
				"CL_TIME desc");
		Log.e("转换数据", list.toString());
		for (SBCL_DATA sbcl_DATA : list) {
			data = new MeasurementData();
			data.setClTime(sbcl_DATA.getCL_TIME());
			data.setClType(sbcl_DATA.getCL_TYPE());
			data.setClTypeName(sbcl_DATA.getCL_TYPE_NAME());
			data.setClValue(sbcl_DATA.getCL_VALUE());
			data.setDeviceName(sbcl_DATA.getDEVICE_NAME());
			data.setDeviceType(sbcl_DATA.getDEVICE_TYPE());
			data.setGuid(sbcl_DATA.getGUID());
			data.setId(sbcl_DATA.getID() + "");
			data.setIdcard(sbcl_DATA.getIDCARD());
			dataList.add(data);
			listId.add(sbcl_DATA.getID());
		}
		
		
		
		recordData.setDataList(dataList);
		recordData.setListId(listId);
		return recordData;
	}

	public static class RecordData {
		private List<MeasurementData> dataList;
		private List<Integer> listId;

		public List<MeasurementData> getDataList() {
			return dataList;
		}

		public void setDataList(List<MeasurementData> dataList) {
			this.dataList = dataList;
		}

		public List<Integer> getListId() {
			return listId;
		}

		public void setListId(List<Integer> listId) {
			this.listId = listId;
		}

	}

}
